﻿using System;
using System.Collections;
using System.Linq;
using System.Text;
using System.Collections.Generic;

namespace TB.BLL
{
    public class Dianpu
    {
        private DALFactory.DALFactory dataFactory = DataProvider.DefaultProvider;
        public int Add(Entity.dianpu obj)
        {
            return dataFactory.DALDianpuProvider.Insert(obj);
        }

        public int GetDianpuSum()
        {
            return dataFactory.DALDianpuProvider.GetDianpuSum();
        }

        public int UpdateTemplateID(int shopid,string templateId)
        {
            return dataFactory.DALDianpuProvider.UpdateTemplateId(shopid, templateId);
        }

        public System.Data.DataSet GetRecord(int num,string colName)
        {
            string strSql = "select top "+num+" "+colName+" from dianpu d where d.sjName is not NULL and d.templateID is NULL order by shopId";
            System.Data.DataSet ds = dataFactory.DALDianpuProvider.GetDataSet(strSql);
            return ds;
        }

        public System.Data.DataSet GetRecordDataSet()
        {
            string strSql = "select top 10000 *from dianpu";
            return dataFactory.DALDianpuProvider.GetDataSet(strSql);
        }

        public System.Data.DataSet GetPages(int currentPage, int pageSize, out int counts, out int pageNums)
        {
            return dataFactory.DALDianpuProvider.PartPageFunc(currentPage, pageSize, out counts, out pageNums,"");
        }

        public System.Data.DataSet GetPages(int currentPage, int pageSize, out int counts, out int pageNums, string conditionWhere)
        {
            return dataFactory.DALDianpuProvider.PartPageFunc(currentPage, pageSize, out counts, out pageNums, conditionWhere);
        }

        /// <summary>
        /// 得到所有未更新店铺的URL
        /// </summary>
        /// <returns>返回数据中的1000行到DataSet便于WebService中返回数据给,</returns>
        public System.Data.DataSet GetGxDpUrl(out int noGxSum,string zdDate,int daysNum)
        {
            System.Data.DataSet dsUrl =new System.Data.DataSet();
            dsUrl = dataFactory.DALDianpuProvider.LoadAllGx(out noGxSum, zdDate,daysNum);
            return dsUrl;
        }
    }
}
